package main

import (
	"flag"
	"time"

	"mig/pkg/profile"
	"mig/pkg/utils"
	"mig/pkg/workflow"
)

var (
	cpuProfile   = flag.String("cpuprofile", "./cpu.prof", "write CPU profile to file")
	memProfile   = flag.String("memprofile", "./mem.prof", "write memory profile to file")
	workflowPath = flag.String("workflow", "./testdata/workflow.yaml", "path to workflow file")
)

func main() {
	flag.Parse()

	utils.ReportBenchmarkJSON(".", "Test", func() {
		time.Sleep(1)
	}, time.Second, 1)

	profiler := profile.NewProfiler(*cpuProfile, *memProfile)
	profiler.Start()
	defer profiler.Stop()

	w := utils.MustLoad[*workflow.Workflow](*workflowPath)
	_, runErr := w.Run()
	if runErr != nil {
		panic(runErr)
	}
}
